﻿using System.Collections.Generic;

namespace Chimp.Core
{
    public class xReadTexture2DNode : ChimpFXNode
    {
        public xReadTexture2DNode()
            : base("xReadTexture2DNode", EffectNodeType.Function)
        {
            AddIn(EffectParameterType.Texture2D, "Texture2D", "Texture2D Input");
            AddOut(EffectParameterType.Vector4, "RGBA", "RGBA Color Value");
        }

        public override void ProduceSegment(List<ChimpEffectPar> pars)
        {
            ChimpFX.Code("vec4 tex2d_" + In[0].To.Owner.PropNodeName + "_" + Out[0].ID + " = texture2D( " +
                   In[0].To.Owner.PropNodeName + " ,gl_TexCoord[0]);");
            PropNodeName = "tex2d_" + In[0].To.Owner.PropNodeName;
        }

        public override ChimpFXNode CreateNew()
        {
            return new xReadTexture2DNode();
        }
    }
}